from django.db import models

# Create your models here.


class Metal(models.Model):
    """store metal name"""
    name = models.CharField(max_length=20)
    date_added = models.DateTimeField(auto_now_add=True)

    class Meta:
        """change display name of the model"""
        verbose_name_plural = "金属类型"

    def __str__(self):
        """Return string for representation of the model"""
        return self.name


class Detail(models.Model):
    """store the detail of the metal"""
    metal = models.ForeignKey(Metal, on_delete=models.CASCADE)
    name = models.TextField()
    date_added = models.DateTimeField(auto_now_add=True)

    class Meta:
        """change display name of the model"""
        verbose_name_plural = "金属的详细信息"

    def __str__(self):
        """Return string for representation of the model"""
        return self.name
